package com.jayson.mymvc.pojo;

import java.lang.reflect.Method;
import java.util.*;

public class Handler {

    private Object controller;

    private Method method;

    private String url;

    // 参数顺序,是为了进行参数绑定，key是参数名，value代表是第几个参数 <name,2>
    private Map<String, Integer> paramIndexMapping;

    // 保存可以通过安全验证的用户名
    private Set<String> userSet;

    public Handler(Object controller, Method method, String url) {
        this.controller = controller;
        this.method = method;
        this.url = url;
        this.paramIndexMapping = new HashMap<>();
        this.userSet = new HashSet<>();
    }

    public Object getController() {
        return controller;
    }

    public void setController(Object controller) {
        this.controller = controller;
    }

    public Method getMethod() {
        return method;
    }

    public void setMethod(Method method) {
        this.method = method;
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public Map<String, Integer> getParamIndexMapping() {
        return paramIndexMapping;
    }

    public void setParamIndexMapping(Map<String, Integer> paramIndexMapping) {
        this.paramIndexMapping = paramIndexMapping;
    }

    public Set<String> getUserSet() {
        return userSet;
    }

    public void setUserSet(Set<String> userSet) {
        this.userSet = userSet;
    }
}
